package com.sheep.mybatis.plus.controller;

import java.util.Map;

import com.github.yulichang.wrapper.MPJLambdaWrapper;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class Mains {
    
    public static void main(String[] args) {
                // 创建MPJLambdaWrapper对象
                MPJLambdaWrapper<Map<String, Object>> lambdaWrapper = new MPJLambdaWrapper<>();

                // 动态传递表名
                String tableName1 = "user";
                // 构建关联查询条件
                String tableName2 = "order";
                String joinCondition = tableName1 + ".id = " + tableName2 + ".user_id";
                // 构建查询条件
                lambdaWrapper.eq(tableName1 + ".id", 1); // 表示查询表名为user，id字段等于1的记录
                lambdaWrapper.select("id", "name");
                // 多表关联查询
                lambdaWrapper.innerJoin(true, joinCondition);
                log.info(lambdaWrapper.getSqlSelect());
    }
}
